<div ng-controller='UserIndex' class='right-cont'>
    <div class='title'>
        <i class='fa fa-list-ul'></i>
        用户管理
    </div>

    <div class='box-cont'>
        <div>
            <button class='btn btn-primary btn-sm btn-w-sm btn-shadow' 
                data-toggle='modal' data-target='.modal-add-user'>添加</button>

            <button class='btn btn-success btn-sm btn-w-sm btn-shadow' 
                ng-click='batch_change_status("resumeuser")'>启用</button>

            <button class='btn btn-warning btn-sm btn-w-sm btn-shadow' 
                ng-click='batch_change_status("forbiduser")'>禁用</button>

            <button class='btn btn-danger  btn-sm btn-w-sm btn-shadow' 
                ng-click='batch_change_status("deleteuser")'>删除</button>

            <div class='box-fr'>
                <div class='input-group input-group-xs pull-right radius'>
                    <input class='form-control radius' type='text' ng-model='nickname' placeholder='输入关键词'>
                    <span class='input-group-btn'>
                        <button class='btn btn-success radius' ng-click='change_data(1)'>搜索</button>
                    </span>
                </div>
            </div>
        </div>

        <hr class='hr-sm'>

        <table class='table table-list wrap-checkbox'>
            <tr>
                <td><input type='checkbox' class='check-all'></td>
                <td>用户ID</td>
                <td>用户昵称 </td>
                <td>最后登录IP </td>
                <td>最后登录时间 </td>
                <td>用户状态 </td>
                <td>操作 </td>
            </tr>
            <tr ng-repeat='user in users'>
                <td><input type='checkbox' name='id[]' value='{{user.uid}}'></td>
                <td>{{user.uid}}</td>
                <td>{{user.nickname}}</td>
                <td>{{user.last_login_ip}}</td>
                <td>{{user.last_login_time}}</td>
                <td>
                    <span class='label label-sm label-success' ng-if='user.status == 1'>
                        {{user.status_text}}
                    </span>
                    <span class='label label-sm label-warning' ng-if='user.status == 0'>
                        {{user.status_text}}
                    </span>
                </td>
                <td>
                    <button class='btn btn-primary btn-xs btn-w-xs' 
                        ng-click='change_groups(user.uid)'>
                        授权
                    </button>
                    <span ng-if='user.status == 1'>
                        <button class='btn btn-warning btn-xs btn-w-xs' 
                            ng-click='change_status(user.uid, "forbiduser")'>
                            禁用
                        </button>
                    </span>
                    <span ng-if='user.status == 0'>
                        <button class='btn btn-success btn-xs btn-w-xs' 
                            ng-click='change_status(user.uid, "resumeuser")'>
                            启用
                        </button>
                    </span>
                    <button class='btn btn-success btn-xs btn-w-xs'
                            ng-click='change_pwd(user.uid)'>
                        修改密码
                    </button>
                    <button class='btn btn-danger btn-xs btn-w-xs' 
                        ng-click='change_status(user.uid, "deleteuser")'>
                        删除
                    </button>
                </td>
            </tr>
        </table>

        <div class='box-page' ng-bind-html='pages'></div>
    </div>

    <div class='modal fade change-user-group'>
        <div class='modal-dialog'>
            <div class='modal-content'>
                <div class='modal-header'>
                    用户授权
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <span class='box-checkbox' ng-repeat='group in groups'>
                        <input type='checkbox' name='group_id[]' value='{{group.id}}'>
                        {{group.title}}
                    </span>
                </div>
                <div class='modal-footer'>
                    <button class='btn btn-primary btn-sm btn-w-sm' ng-click='save_groups()'>确定</button>
                    <button class='btn btn-default btn-sm btn-w-sm' data-dismiss='modal'>取消</button>
                </div>
            </div>
        </div>
    </div>

    <div class='modal fade modal-add-user'>
        <div class='modal-dialog'>
            <div class='modal-content' align='center'>
                <div class='modal-header'>
                    用户添加
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <table class='table-form'>
                        <tr>
                            <td class='td-label'>用户名:</td>
                            <td><input type='text' class='form-control input-sm' ng-model='aUsername'></td>
                        </tr>
                        <tr>
                            <td class='td-label'>密&nbsp;&nbsp;&nbsp;码:</td>
                            <td><input type='password' class='form-control input-sm' ng-model='aPassword'></td>
                        </tr>
                        <tr>
                            <td class='td-label'>密&nbsp;&nbsp;&nbsp;码:</td>
                            <td><input type='password' class='form-control input-sm' ng-model='aRepassword'></td>
                        </tr>
                        <tr>
                            <td class='td-label'>邮&nbsp;&nbsp;&nbsp;箱:</td>
                            <td><input type='text' class='form-control input-sm' ng-model='aEmail'></td>
                        </tr>
                    </table>
                </div>
                <div class='modal-footer'>
                    <button class='btn btn-primary btn-sm btn-w-sm' ng-click='add_user()'>确认</button>
                    <button class='btn btn-default btn-sm btn-w-sm' data-dismiss='modal'>取消</button>
                </div>
            </div>
        </div>
    </div>
    <!--//修改密码-->
    <div class='modal fade modal-adedit-userPwd'  tabindex="-1" role="dialog"
         aria-labelledby="ModalLabel" aria-hidden="true" style="color: black">
        <div class='modal-dialog'>
            <div class='modal-content' align='center'>
                <div class='modal-header'>
                    密码修改
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <div class="form-horizontal" role="form">

                        <div class='form-group'>
                            <label class='col-sm-3 control-label'>新密码</label>
                            <div class='col-sm-7'>
                                <input type='password' class='form-control' ng-model='ad_new_pwd' />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class='col-sm-3 control-label'>确认密码</label>
                            <div class='col-sm-7'>
                                <input type='password' class='form-control' ng-model='ad_q_pwd' />
                            </div>
                        </div>
                    </div>
                </div>
                <div class='modal-footer'>
                    <button type="button" class='btn btn-primary' ng-click='ad_changePwd()'>提交</button>
                </div>
            </div>
        </div>
    </div>
</div>